import { EventManager } from "../manager/EventManager";

/**
 * 基础弹窗
 */
export class BaseComponent extends eui.Component {
	public constructor() {
		super();
		this.left = this.right = this.top = this.bottom = 0;
	}

	/** 创建完毕开始逻辑处理 */
	protected childrenCreated(): void {
		this.addEvent();
		this.init();
	}

	/** 界面事件添加 */
	public addEvent(): void {

	}

	/** 界面初始化调用 */
	public init(): void {

	}

	/**
     *界面销毁会调用
     */
	public dispose(): void {
		this.removeChildren();
		if (this.parent) { this.parent.removeChild(this); }
		EventManager.unRegistersAll(this);
		egret.Tween.removeTweens(this);
	}
}